<?php

namespace backend\models\odm;

use Yii;

/**
 * This is the model class for table "xs_title".
 *
 * @property string $id
 * @property string $name
 * @property integer $status
 * @property string $create_time
 * @property string $update_time
 */
class TitleOdm extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'xs_title';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['status'], 'integer'],
            [['create_time', 'update_time'], 'safe'],
            [['name'], 'string', 'max' => 100],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'id'),
            'name' => Yii::t('app', '标题名称'),
            'status' => Yii::t('app', '状态'),
            'create_time' => Yii::t('app', '创建时间'),
            'update_time' => Yii::t('app', '修改时间'),
        ];
    }
    
    /**
     * 批量删除标题
     */
    public function delTitles($ids) {
        $sql = "delete from xs_title where id in (".$ids.")";
        echo $sql;
    }
    
    
    public function getTitleInfo($id){
        $sql = "select * from xs_title where id = ".$id;
        $info = Yii::$app->db->createCommand($sql)->queryOne();
        return $info;
    }
}
